﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TaskManagement.ModelLayer;

namespace DataAccess
{
    public interface IDBWorkflow
    {
        /// <summary>
        /// Searchs trough workflows in the database
        /// </summary>
        /// <param name="searchWorkflow">The workflow containing the data to search for</param>
        /// <returns>A list of workflows matching the search or null if a error occured</returns>
        List<Workflow> SearchWorkflows(Workflow searchWorkflow);

        /// <summary>
        /// Creates a workflowentity in the database
        /// </summary>
        /// <param name="w">The Workflow containing the data to be insearted. Cannot have a id other than 0</param>
        /// <returns>The id of the workflow og 0 if an error occured</returns>
        int CreateWorkflow(Workflow w);


        /// <summary>
        /// Updates a workflow in the db
        /// </summary>
        /// <param name="w">The workflow containing the original id and then new data</param>
        /// <returns>return 1 on succes and 0 if an error occured</returns>
        int UpdateWorkflow(Workflow w);

        /// <summary>
        /// Checks if the tasks that a part of this workflow stats before the new date
        /// </summary>
        /// <param name="workflow">The workflow with the new date</param>
        /// <returns>true if a tasks has a date that is before the start date and false otherwise</returns>
        bool CheckTaskDates(Workflow workflow);

        /// <summary>
        /// Delete a workflow from the database
        /// </summary>
        /// <param name="workflow">The workflow to delete</param>
        /// <returns>1 if succesfull or 0 if an error occured</returns>
        int DeleteWorkflow(IList<Workflow> workflows);
    }
}
